<template>
  <div>
    <el-form label-position="right" label-width="100px" :model="admin">
      <el-form-item label="管理员账号">
        <el-input v-model="admin.account"></el-input>
      </el-form-item>
      <el-form-item label="管理员密码">
        <el-input v-model="admin.password"></el-input>
      </el-form-item>
      <el-form-item label="管理员姓名">
        <el-input v-model="admin.name"></el-input>
      </el-form-item>
      <el-form-item label="管理员权限">
        <el-radio-group v-model="admin.permissions">
          <el-radio label="true" value="true">可操作</el-radio>
          <el-radio label="false" value="false">禁止</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="addAdmin(admin)">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapActions} = createNamespacedHelpers(
  "admins"
);
export default {
  data() {
    return {
      admin: {
        // 姓名
        name: "",
        // 账号
        account: "",
        // 密码
        password: "",
        // 权限
        permissions: true,
      },
    };
  },
  methods: {
    ...mapActions(["addAdmin"]),
  },
};
</script>
